Included failsafe and edited break condition #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Steven,
I found out that the 'while' loop new_masses() loops indefinitely if all the previous stars are considered as stars (i.e. if no stars are filtered out in lines 72-80). This scenario unfortunately happens frequently when
stellar_mass~ 10 MSun, and almost definitely happen whenstellar_massis small. I think this is due to two reasons:previous_number_of_starslen(additional_mass)len(mass)and so on. The condition will never be true for any
len(additional_mass)(edit: correct logic). Please correct me if I misunderstood, but I think you probably wantlen(mass) > number_of_stars, wherenumber_of_starsis the parameter.len(additional_mass)becomes 0 within 2 iterations. A failsafe is needed to break the loop. I set the max count to 10, but this can be added as a parameter (though I doubt it needs changing).Thanks!